home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / TEXT2DBF.ZIP;1 / READ.ME < prev    next >
Encoding:
Text File  |  1992-09-22  |  4.4 KB  |  102 lines

  1.  
  2. OVERVIEW:
  3. ---------
  4. This is a handy program that I wrote in Clipper 5.01.  It takes an ASCII
  5. file for input and creates a dBase III+ or Clipper .DBF file as output.
  6.  
  7. "Why don't you just use the dBase APPEND FROM ... SDF command, stupid!?"
  8. you may ask. Well there are several reasons why TEXT2DBF is better in
  9. many situations:
  10.  
  11.    1) You may not have dBase or FoxPro handy
  12.    2) You may want to do more formatting or conversion than is possible
  13.         with APPEND FROM ... SDF
  14.    3) You might not want all of the data in the text file
  15.    4) You may want to append data into an existing database that is not
  16.         in the same format as the text file
  17.    5) You can run TEXT2DBF from a batch file for automated procedures
  18.  
  19. The power of TEXT2DBF lies in the Conversion Definition Files (.CDF) that
  20. specify how the text information is extracted and formatted for the .DBF
  21. output file.  Take a look at the sample TEST.CDF to get an idea of what a
  22. CDF looks like.  Basically, you specify the file structure of the output
  23. .DBF file along with standard Clipper 5.01 expressions to retrieve and
  24. format the text data.  Below is a sample CDF file for a simple 3 field file.
  25.  
  26.    ACCOUNT    |C|  7|  0| SUBSTR(cRec,1,7)
  27.    AMOUNT     |N|  9|  0| VAL(SUBSTR(cRec,8,9))
  28.    DATE       |D|  8|  0| CTOD(SUBSTR(cRec,17,8))
  29.  
  30. As you can see, you merely specify the field name, type, length, and decimals,
  31. along with the expression to retrieve/format the text data.  In the expression,
  32. you assume that the variable "cRec" contains one record from the text file.
  33. Refer to TEST.CDF for more explanation and examples.
  34.  
  35. Since YOU specify how to extract the data, you can skip any data you don't need,
  36. format/convert the data to your heart's content, insert data not found in the
  37. source text file, etc..  To do this kind of formatting with dBase would require
  38. many MODIFIY STRUCTURE and REPLACE passes through the database - TEXT2DBF
  39. does it in a single pass!
  40.  
  41.  
  42.  
  43. RUNNING THE PROGRAM:
  44. --------------------
  45. To run the program you must specify the source file, destination file, and
  46. CDF file:
  47.  
  48.    Example:  TEXT2DBF TEST.TXT TEST.DBF TEST.CDF
  49.  
  50. The .DBF file will be created if neccessary.  If the .DBF file already exists,
  51. the structure will be compared to that in the .CDF file to make sure that the
  52. file is compatible, then records will be appended into the existing file.
  53.  
  54.  
  55.  
  56. TECHNICAL DEPARTMENT:
  57. ---------------------
  58. TEXT2DBF.EXE requires the Pre-Linked Library (PLL) FULLBASE.PLL.  The reason
  59. FULLBASE.PLL is so large is because it contains ALL of the functions found
  60. in CLIPPER.LIB and EXTEND.LIB.  FULLBASE.PLL needs to reside either in the
  61. current directory from which TEXT2DBF is executed, somewhere on your path, or
  62. in the directory specified by the DOS environment variable PLL
  63. (i.e. SET PLL=C:\CLIPPER5\PLL).
  64.  
  65. I felt it was better to link the program this way so that ANY clipper function
  66. would be available for expressions.  If you wanted to create a stand-alone .EXE
  67. file, you need to decide which functions you want to allow for expressions and
  68. declare them EXTERNAL in TEXT2DBF.PRG so that the linker will pull them into
  69. the .EXE file.
  70.  
  71. To compile the file:   CLIPPER text2dbf /n /m
  72. To link using RTlink:  RTLINK  @text2dbf
  73.  
  74. TEXT2DBF does extensive checking of the CDF file for errors, if a function is
  75. referenced that is not found in TEXT2DBF.PRG, CLIPPER.LIB, or EXTEND.LIB, you
  76. will not be able to process the file.  You also will not be able to specify
  77. invalid field information.
  78.  
  79. TEXT2DBF has some good examples of how to do low-level file IO in Clipper and
  80. also demonstrates a good use of codeblocks.  The expressions found in the CDF
  81. files are converted to codeblocks and stored in an array, then each codeblock
  82. is evaluated in a FOR loop for each text record, and the resulting data is
  83. stored in the corresponding database field.  Cool, huh?
  84.  
  85.  
  86.  
  87. PATHETIC PLEA FOR DONATIONS DEPARTMENT:
  88. ---------------------------------------
  89. I basically wrote this program for my own use and don't know if anybody else
  90. will want to use it or not.  All I ask is that if you do use it and derive any
  91. benefit from its use, please send a donation of $5.00 or more to:
  92.  
  93.                    David Christian
  94.                    BITwise Computer Services
  95.                    PO BOX 97642
  96.                    Raleigh, NC 27624-7642
  97.  
  98. If you send a check, please make it out to David Christian or David Christian
  99. dba BITwise Computer Services.
  100.  
  101. //EOF
  102.